﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Products.aspx.cs" Inherits="Products" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Products</title>

    <script language="JavaScript" src="js/CalendarPopup.js"></script>

    <script language="JavaScript">
        var cal = new CalendarPopup();
    </script>

    <style>
        select
        {
            width: 145px !important;
        }
        input
        {
            width: 140px !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <table>
            <tr>
                <td>
                    Product ID:
                </td>
                <td>
                    <asp:TextBox ID="txtProductID" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Product Name:
                </td>
                <td>
                    <asp:TextBox ID="txtProductName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfProductName" runat="server" ControlToValidate="txtProductName"
                        Display="Dynamic" ErrorMessage="Please enter name!" ValidationGroup="Validate"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Supplier:
                </td>
                <td>
                    <asp:DropDownList ID="ddlSupplier" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    Category:
                </td>
                <td>
                    <asp:DropDownList ID="ddlCategory" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    Unit Price:
                </td>
                <td>
                    <asp:TextBox ID="txtUnitPrice" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfUnitPrice" runat="server" ControlToValidate="txtUnitPrice"
                        ErrorMessage="Please enter price!" ValidationGroup="Validate"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="cvUnitPrice" runat="server" ControlToValidate="txtUnitPrice"
                        ErrorMessage="Invalid Unit Price!" Operator="GreaterThanEqual" Type="Double"
                        ValidationGroup="Validate"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Discontinued:
                </td>
                <td>
                    <asp:CheckBox ID="rdDiscontinued" runat="server"></asp:CheckBox>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table>
            <tr>
                <td>
                    <asp:Button ID="btnNew" runat="server" Text="New" Width="65px" OnClick="btnNew_Click" />
                    <asp:Button ID="btnAdd" runat="server" Text="Add" Width="65px" OnClick="btnAdd_Click"
                        ValidationGroup="Validate" />
                    <asp:Button ID="btnUpdate" runat="server" Text="Update" Width="65px" OnClick="btnUpdate_Click"
                        ValidationGroup="Validate" />
                    <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="65px" OnClick="btnDelete_Click" />
                </td>
            </tr>
        </table>
    </div>
    <div>
        <table>
            <tr>
                <td>
                    <asp:TextBox ID="txtSearchName" runat="server" Width="210px"></asp:TextBox>
                    <asp:DropDownList ID="cbSearch" runat="server" Width="179px">
                        <asp:ListItem>Product Name</asp:ListItem>
                        <asp:ListItem>Supplier</asp:ListItem>
                        <asp:ListItem>Category</asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                    <asp:Button ID="btnReload" runat="server" Text="Reload" OnClick="btnReload_Click" />
                </td>
            </tr>
        </table>
    </div>
    <asp:GridView ID="gvProducts" runat="server" OnPageIndexChanging="gvProducts_PageIndexChanging"
        OnSelectedIndexChanged="gvProducts_SelectedIndexChanged" AutoGenerateColumns="False">
        <Columns>
            <asp:BoundField DataField="productid" HeaderText="Product ID" />
            <asp:BoundField DataField="productname" HeaderText="Product Name" />
            <asp:BoundField DataField="supplierid" HeaderText="Supplier ID" />
            <asp:BoundField DataField="categoryid" HeaderText="Category ID" />
            <asp:BoundField DataField="unitprice" HeaderText="Unit Price" />
            <asp:BoundField DataField="discontinued" HeaderText="Discontinued" />
        </Columns>
    </asp:GridView>
</asp:Content>
